/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package net.tygzs.minerpg.CommandExecutor.MinePacket;

import net.md_5.bungee.api.ChatColor;
import net.tygzs.minerpg.Configuration.packet.Packet;
import net.tygzs.minerpg.Main;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

/**
 *
 * @author thtTNT
 */
public class Command_Send
{

    public static void SendPacketToPlayer(CommandSender sender, String PacketName, String PlayerName)
    {
        Player player = Bukkit.getPlayer(PlayerName);
        if (player == null)
        {
            sender.sendMessage(ChatColor.RED + "您输入的玩家不在线");
            return;
        }
        if (!Main.getPluginConfig().getPackets().containsKey(PacketName))
        {
            sender.sendMessage(ChatColor.RED + " 您输入的礼包不存在");
            return;
        }
        Main.getPluginConfig().getPackets().get(PacketName).sendPacket(player);
        sender.sendMessage(ChatColor.GREEN + "发送成功");
    }
}
